import request from '@/utils/request.js';

// register login logout updatePwd
export function userRegisterService(registerData) {
    return request.post('/user/register', registerData);
}

export function userLoginService(loginData) {
    return request.post('/user/login', loginData);
}

export function userLogoutService(userId) {
    return request.get('/user/logout/' + userId);
}

export function userUpdatePwdService(identity,id,oldPwd,newPwd) {
    return request.put('/user/updatePwd', { identity,id,oldPwd,newPwd });
}

// manager
export function managerGetService(search, currentPage, pageSize) {
    return request.get('/manager', { params: { search, currentPage, pageSize } });
}

export function managerCreateService(createData) {
    return request.post('/manager', createData);
}

export function managerUpdateService(updateData) {
    return request.put('/manager', updateData);
}

export function managerDeleteService(managerId) {
    return request.delete('/manager/' + managerId);
}

export function managerGetRoleService() {
    return request.get('/manager/role');
}

// employee
export function employeeGetService(search, currentPage, pageSize) {
    return request.get('/employee', { params: { search, currentPage, pageSize } });
}

export function employeeCreateService(createData) {
    return request.post('/employee', createData);
}

export function employeeUpdateService(updateData) {
    return request.put('/employee', updateData);
}

export function employeeDeleteService(employeeId) {
    return request.delete('/employee/' + employeeId);
}

export function employeeGetRoleService() {
    return request.get('/employee/role');
}

export function employeeGetFormedService() {
    return request.get('/employee/getFormedEmployee');
}

// export function employeeGetDutyService(categoryId) {
//     return request.get('/employee/getDutyEmployee/' + categoryId);
// }

// employee termination
export function employeeGetUnreceivedWorkorderService(employeeId) {
    return request.get('/employee/unreceived/' + employeeId);
}

export function employeeAcceptWorkorderService(employeeId, workOrderId) {
    return request.put('/employee/receive', { employeeId, workOrderId });
}

export function employeeGetCountService(employeeId) {
    return request.get('/employee/getCount/' + employeeId);
}

export function employeeGetWorkorderService(employeeId, search, currentPage, pageSize) {
    return request.get('/employee/received/' + employeeId, { params: { search, currentPage, pageSize } });
}

export function employeeHandleWorkorderService(employeeId, workOrderId, handleRemark) {
    return request.put('/employee/handle', { employeeId, workOrderId, handleRemark });
}

// tenant
export function tenantGetPlainService() {
    return request.get('/tenant/plain');
}

export function tenantGetService(search, currentPage, pageSize) {
    return request.get('/tenant', { params: { search, currentPage, pageSize } });
}

export function tenantCreateService(createData) {
    return request.post('/tenant', createData);
}

export function tenantUpdateService(updateData) {
    return request.put('/tenant', updateData);
}

export function tenantDeleteService(tenantId) {
    return request.delete('/tenant/' + tenantId);
}

// tenant termination
export function tenantGetStatService(tenantId) {
    return request.get('/tenant/stat/' + tenantId);
}

export function tenantGetHouseService(tenantId, search, currentPage, pageSize) {
    return request.get('/tenant/house/' + tenantId, { params: { search, currentPage, pageSize } });
}

export function tenantGetRentabelHouseService(search, currentPage, pageSize) {
    return request.get('/tenant/rentable', { params: { search, currentPage, pageSize } });
}

export function tenantRentService(tenantId, houseId) {
    return request.post('/tenant/rent', { tenantId, houseId });
}

export function tenantStopRentService(houseId) {
    return request.post('/tenant/stopRent', { houseId });
}

export function tenantChangeHouseStatusService(houseId, statusId) {
    return request.put('/tenant/status', { houseId, statusId });
}

export function tenantGetWorkorderService(tenantId, search, currentPage, pageSize) {
    return request.get('/tenant/workOrder/' + tenantId, { params: { search, currentPage, pageSize } });
}

export function tenantGetAllHouseService(tenantId) {
    return request.get('/tenant/allHouse/' + tenantId);
}

export function tenantCreateWorkorderService(tenantId, createData) {
    return request.post('/tenant/createWorkOrder/' + tenantId, createData);
}
